package com.link.base.base.crowd.controller;

import com.link.base.base.crowd.model.CrowdAcct;
import com.link.base.base.crowd.service.CrowdAcctService;
import com.link.base.core.basic.util.CodeCleanUtils;
import com.link.core.cllog.LCLogger;
import com.link.core.basic.controller.BasicController;
import com.link.core.basic.service.BasicService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 人群-消费者中间表
 * @author lujiang
 * @date 2019-05-29
 */
@Controller
@RequestMapping("/link/crowdAcct")
public class CrowdAcctController extends BasicController<CrowdAcct> {

    @Resource
    private CrowdAcctService crowdAcctService;

    @Override
    public BasicService<CrowdAcct> getBasicService() {
        return crowdAcctService;
    }

    /**
     * 查询人群包下公众号信息
     *
     * @author lujiang
     * @date 2019-05-29
     * @param entity
     * @return
     */
    @RequestMapping(value = "/queryCrowdAcctFans")
    @ResponseBody
    public Map<String, Object> queryCrowdAcctFans(@RequestBody CrowdAcct entity) {
        Map<String, Object> result = CodeCleanUtils.cast(new HashMap(16));
        try {
            entity = crowdAcctService.queryCrowdAcctFans(entity);
            result.put("result",entity);
            result.put("success", true);
        } catch (Exception e) {
            LCLogger.withException(e);
            result.put("success", false);
            result.put("result", e.getMessage());
        }
        return result;
    }
}
